<!DOCTYPE html>
<!-- saved from url=(0048)https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84 -->
<html lang="en" class=" is-u2f-enabled"><head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    

    <link crossorigin="anonymous" href="数组 · d3_d3 Wiki_files/frameworks-c07e6f4b02b556d1d85052fb3853caf84c80e6b23dcdb1ae1b00f051da1115a2.css" integrity="sha256-wH5vSwK1VtHYUFL7OFPK+EyA5rI9zbGuGwDwUdoRFaI=" media="all" rel="stylesheet">
    <link crossorigin="anonymous" href="数组 · d3_d3 Wiki_files/github-09e1c38d593bf8fc6e4c4f1b526d0184e27c433d64963942c1e8c361589f8125.css" integrity="sha256-CeHDjVk7+PxuTE8bUm0BhOJ8Qz1kljlCwejDYVifgSU=" media="all" rel="stylesheet">
    
    
    
    

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Language" content="en">
    <meta name="viewport" content="width=device-width">
    
    <title>数组 · d3/d3 Wiki</title>
    <link rel="search" type="application/opensearchdescription+xml" href="https://github.com/opensearch.xml" title="GitHub">
    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
    <link rel="apple-touch-icon" href="https://github.com/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="57x57" href="https://github.com/apple-touch-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="https://github.com/apple-touch-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="https://github.com/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="https://github.com/apple-touch-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="https://github.com/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="https://github.com/apple-touch-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="https://github.com/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="https://github.com/apple-touch-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="https://github.com/apple-touch-icon-180x180.png">
    <meta property="fb:app_id" content="1401488693436528">

      <meta content="https://avatars1.githubusercontent.com/u/1562726?v=3&amp;s=400" name="twitter:image:src"><meta content="@github" name="twitter:site"><meta content="summary" name="twitter:card"><meta content="d3/d3" name="twitter:title"><meta content="d3 - Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:" name="twitter:description">
      <meta content="https://avatars1.githubusercontent.com/u/1562726?v=3&amp;s=400" property="og:image"><meta content="GitHub" property="og:site_name"><meta content="object" property="og:type"><meta content="d3/d3" property="og:title"><meta content="https://github.com/d3/d3" property="og:url"><meta content="d3 - Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:" property="og:description">
      <meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
    <meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
    <link rel="assets" href="https://assets-cdn.github.com/">
    <link rel="web-socket" href="wss://live.github.com/_sockets/VjI6MTQyMzUxMDM1Ojk5YWUwZDY1Y2Y4YzNhZTBkNDAxZTI2YzE3Y2JkNmQ3ZGNiOWNlMTM5NjVkMzM4YmZlN2RlMWQwYmViYWVhMmQ=--ab519fd2bdcd293d1c7597d287ac87c0c5149509">
    <meta name="pjax-timeout" content="1000">
    <link rel="sudo-modal" href="https://github.com/sessions/sudo_modal">
    <meta name="request-id" content="E381:7555:1145F6C:1C632A9:58845365" data-pjax-transient="">

    <meta name="msapplication-TileImage" content="/windows-tile.png">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="selected-link" value="repo_wiki" data-pjax-transient="">

    <meta name="google-site-verification" content="KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU">
<meta name="google-site-verification" content="ZzhVyEFwb7w3e0-uOTltm8Jsck2F5StVihD0exw2fsA">
    <meta name="google-analytics" content="UA-3769691-2">

<meta content="collector.githubapp.com" name="octolytics-host"><meta content="github" name="octolytics-app-id"><meta content="E381:7555:1145F6C:1C632A9:58845365" name="octolytics-dimension-request_id"><meta content="18323475" name="octolytics-actor-id"><meta content="defenderhhhh" name="octolytics-actor-login"><meta content="70592ef2d225e449076dd88e6b12c145017fd92eccf81e729a16009ced6970cb" name="octolytics-actor-hash">
<meta content="/<user-name>/<repo-name>/wiki/show" data-pjax-transient="true" name="analytics-location">



  <meta class="js-ga-set" name="dimension1" content="Logged In">



        <meta name="hostname" content="github.com">
    <meta name="user-login" content="defenderhhhh">

        <meta name="expected-hostname" content="github.com">
      <meta name="js-proxy-site-detection-payload" content="ZTY1NGFiYTIzZDA5Y2VmZDI3YmFiYjRkY2M3YjRjMWJlMzE3NWEwOWJiNzA2ZGNiOGI5ZmI4MzMwMTM4Nzc4Ynx7InJlbW90ZV9hZGRyZXNzIjoiMjIyLjE4MC4xNjAuMTU0IiwicmVxdWVzdF9pZCI6IkUzODE6NzU1NToxMTQ1RjZDOjFDNjMyQTk6NTg4NDUzNjUiLCJ0aW1lc3RhbXAiOjE0ODUwNjcxMDksImhvc3QiOiJnaXRodWIuY29tIn0=">


      <link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#000000">
      <link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">

    <meta name="html-safe-nonce" content="7da07f67fa3bc09c6326a894464ac00a14a92cab">

    <meta http-equiv="x-pjax-version" content="94a9cc48ead92329faac49833ac14041">
    

      
  <meta name="description" content="d3 - Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:">
  <meta name="go-import" content="github.com/d3/d3 git https://github.com/d3/d3.git">

  <meta content="1562726" name="octolytics-dimension-user_id"><meta content="d3" name="octolytics-dimension-user_login"><meta content="943149" name="octolytics-dimension-repository_id"><meta content="d3/d3" name="octolytics-dimension-repository_nwo"><meta content="true" name="octolytics-dimension-repository_public"><meta content="false" name="octolytics-dimension-repository_is_fork"><meta content="943149" name="octolytics-dimension-repository_network_root_id"><meta content="d3/d3" name="octolytics-dimension-repository_network_root_nwo">
  <link href="https://github.com/d3/d3/commits/master.atom" rel="alternate" title="Recent Commits to d3:master" type="application/atom+xml">


  <style type="text/css"></style></head>


  <body class="logged-in  env-production windows vis-public">
    <div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div>
    <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a>

    
    
    



        <div class="header header-logged-in true" role="banner">
  <div class="container clearfix">

    <a class="header-logo-invertocat" href="https://github.com/" data-hotkey="g d" aria-label="Homepage" data-ga-click="Header, go to dashboard, icon:logo">
  <svg aria-hidden="true" class="octicon octicon-mark-github" height="28" version="1.1" viewBox="0 0 16 16" width="28"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
</a>


        <div class="header-search scoped-search site-scoped-search js-site-search" role="search">
  <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/d3/d3/search" class="js-site-search-form" data-scoped-search-url="/d3/d3/search" data-unscoped-search-url="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
    <label class="form-control header-search-wrapper js-chromeless-input-container">
      <div class="header-search-scope">This repository</div>
      <input type="text" class="form-control header-search-input js-site-search-focus js-site-search-field is-clearable" data-hotkey="s" name="q" placeholder="Search" aria-label="Search this repository" data-unscoped-placeholder="Search GitHub" data-scoped-placeholder="Search" autocapitalize="off">
    </label>
</form></div>


      <ul class="header-nav float-left" role="navigation">
        <li class="header-nav-item">
          <a href="https://github.com/pulls" aria-label="Pull requests you created" class="js-selected-navigation-item header-nav-link" data-ga-click="Header, click, Nav menu - item:pulls context:user" data-hotkey="g p" data-selected-links="/pulls /pulls/assigned /pulls/mentioned /pulls">
            Pull requests
</a>        </li>
        <li class="header-nav-item">
          <a href="https://github.com/issues" aria-label="Issues you created" class="js-selected-navigation-item header-nav-link" data-ga-click="Header, click, Nav menu - item:issues context:user" data-hotkey="g i" data-selected-links="/issues /issues/assigned /issues/mentioned /issues">
            Issues
</a>        </li>
          <li class="header-nav-item">
            <a class="header-nav-link" href="https://gist.github.com/" data-ga-click="Header, go to gist, text:gist">Gist</a>
          </li>
      </ul>

    
<ul class="header-nav user-nav float-right" id="user-links">
  <li class="header-nav-item">
    

  </li>

  <li class="header-nav-item dropdown js-menu-container">
    <a class="header-nav-link tooltipped tooltipped-s js-menu-target" href="https://github.com/new" aria-label="Create new…" data-ga-click="Header, create new, icon:add">
      <svg aria-hidden="true" class="octicon octicon-plus float-left" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 9H7v5H5V9H0V7h5V2h2v5h5z"></path></svg>
      <span class="dropdown-caret"></span>
    </a>

    <div class="dropdown-menu-content js-menu-content">
      <ul class="dropdown-menu dropdown-menu-sw">
        
<a class="dropdown-item" href="https://github.com/new" data-ga-click="Header, create new repository">
  New repository
</a>

  <a class="dropdown-item" href="https://github.com/new/import" data-ga-click="Header, import a repository">
    Import repository
  </a>

<a class="dropdown-item" href="https://gist.github.com/" data-ga-click="Header, create new gist">
  New gist
</a>

  <a class="dropdown-item" href="https://github.com/organizations/new" data-ga-click="Header, create new organization">
    New organization
  </a>



  <div class="dropdown-divider"></div>
  <div class="dropdown-header">
    <span title="d3/d3">This repository</span>
  </div>
    <a class="dropdown-item" href="https://github.com/d3/d3/issues/new" data-ga-click="Header, create new issue">
      New issue
    </a>

      </ul>
    </div>
  </li>

  <li class="header-nav-item dropdown js-menu-container">
    <a class="header-nav-link name tooltipped tooltipped-sw js-menu-target" href="https://github.com/defenderhhhh" aria-label="View profile and more" data-ga-click="Header, show menu, icon:avatar">
      <img alt="@defenderhhhh" class="avatar" height="20" src="数组 · d3_d3 Wiki_files/18323475" width="20">
      <span class="dropdown-caret"></span>
    </a>

    <div class="dropdown-menu-content js-menu-content">
      <div class="dropdown-menu dropdown-menu-sw">
        <div class="dropdown-header header-nav-current-user css-truncate">
          Signed in as <strong class="css-truncate-target">defenderhhhh</strong>
        </div>

        <div class="dropdown-divider"></div>

        <a class="dropdown-item" href="https://github.com/defenderhhhh" data-ga-click="Header, go to profile, text:your profile">
          Your profile
        </a>
        <a class="dropdown-item" href="https://github.com/defenderhhhh?tab=stars" data-ga-click="Header, go to starred repos, text:your stars">
          Your stars
        </a>
        <a class="dropdown-item" href="https://github.com/explore" data-ga-click="Header, go to explore, text:explore">
          Explore
        </a>
          <a class="dropdown-item" href="https://github.com/integrations" data-ga-click="Header, go to integrations, text:integrations">
            Integrations
          </a>
        <a class="dropdown-item" href="https://help.github.com/" data-ga-click="Header, go to help, text:help">
          Help
        </a>

        <div class="dropdown-divider"></div>

        <a class="dropdown-item" href="https://github.com/settings/profile" data-ga-click="Header, go to settings, icon:settings">
          Settings
        </a>

        <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/logout" class="logout-form" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="OdJytR0Qc5YRREwpoZz3GnYu5eFvZBvwUudFohYxRK/TQA9mxx+ncaCgKQefeUCpUydEwD+qiOuezdlgxmI6MA=="></div>
          <button type="submit" class="dropdown-item dropdown-signout" data-ga-click="Header, sign out, icon:logout">
            Sign out
          </button>
</form>      </div>
    </div>
  </li>
</ul>


    
  </div>
</div>


      


    <div id="start-of-content" class="accessibility-aid"></div>

      <div id="js-flash-container">
</div>


    <div role="main">
        <div itemscope="" itemtype="http://schema.org/SoftwareSourceCode">
    <div id="js-repo-pjax-container" data-pjax-container="">
      
<div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav">
  <div class="container repohead-details-container">

    

<ul class="pagehead-actions">

  <li>
        <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/notifications/subscribe" class="js-social-container" data-autosubmit="true" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="yfvN3eJN4e+ANsbAYbvm5B4fA/pauJqNH3DgbzTCSzZ7a67WBdhnaxqb/nwflc8ELFKgf9FBGeJPeBfmfQteZw=="></div>      <input class="form-control" id="repository_id" name="repository_id" type="hidden" value="943149">

        <div class="select-menu js-menu-container js-select-menu">
          <a href="https://github.com/d3/d3/subscription" class="btn btn-sm btn-with-count select-menu-button js-menu-target" role="button" tabindex="0" aria-haspopup="true" data-ga-click="Repository, click Watch settings, action:wiki#show">
            <span class="js-select-button">
              <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"></path></svg>
              Watch
            </span>
          </a>
          <a class="social-count js-social-count" href="https://github.com/d3/d3/watchers" aria-label="2939 users are watching this repository">
            2,939
          </a>

        <div class="select-menu-modal-holder">
          <div class="select-menu-modal subscription-menu-modal js-menu-content" aria-hidden="true">
            <div class="select-menu-header js-navigation-enable" tabindex="-1">
              <svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
              <span class="select-menu-title">Notifications</span>
            </div>

              <div class="select-menu-list js-navigation-container" role="menu">

                <div class="select-menu-item js-navigation-item selected" role="menuitem" tabindex="0">
                  <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path></svg>
                  <div class="select-menu-item-text">
                    <input checked="checked" id="do_included" name="do" type="radio" value="included">
                    <span class="select-menu-item-heading">Not watching</span>
                    <span class="description">Be notified when participating or @mentioned.</span>
                    <span class="js-select-button-text hidden-select-button-text">
                      <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"></path></svg>
                      Watch
                    </span>
                  </div>
                </div>

                <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
                  <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path></svg>
                  <div class="select-menu-item-text">
                    <input id="do_subscribed" name="do" type="radio" value="subscribed">
                    <span class="select-menu-item-heading">Watching</span>
                    <span class="description">Be notified of all conversations.</span>
                    <span class="js-select-button-text hidden-select-button-text">
                      <svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"></path></svg>
                      Unwatch
                    </span>
                  </div>
                </div>

                <div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
                  <svg aria-hidden="true" class="octicon octicon-check select-menu-item-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"></path></svg>
                  <div class="select-menu-item-text">
                    <input id="do_ignore" name="do" type="radio" value="ignore">
                    <span class="select-menu-item-heading">Ignoring</span>
                    <span class="description">Never be notified.</span>
                    <span class="js-select-button-text hidden-select-button-text">
                      <svg aria-hidden="true" class="octicon octicon-mute" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8 2.81v10.38c0 .67-.81 1-1.28.53L3 10H1c-.55 0-1-.45-1-1V7c0-.55.45-1 1-1h2l3.72-3.72C7.19 1.81 8 2.14 8 2.81zm7.53 3.22l-1.06-1.06-1.97 1.97-1.97-1.97-1.06 1.06L11.44 8 9.47 9.97l1.06 1.06 1.97-1.97 1.97 1.97 1.06-1.06L13.56 8l1.97-1.97z"></path></svg>
                      Stop ignoring
                    </span>
                  </div>
                </div>

              </div>

            </div>
          </div>
        </div>
</form>
  </li>

  <li>
      <div class="js-toggler-container js-social-container starring-container ">
    <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/d3/d3/unstar" class="starred" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="rJ3vY+6OrJNqNigZr2NAsMAAyNuhEuYRgYXub3e8sjgb3kzUymOTM0Nh5XFO9TzYECPI2Z4CMfWP1QO28lyk0g=="></div>
      <button type="submit" class="btn btn-sm btn-with-count js-toggler-target" aria-label="Unstar this repository" title="Unstar d3/d3" data-ga-click="Repository, click unstar button, action:wiki#show; text:Unstar">
        <svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"></path></svg>
        Unstar
      </button>
        <a class="social-count js-social-count" href="https://github.com/d3/d3/stargazers" aria-label="59436 users starred this repository">
          59,436
        </a>
</form>
    <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/d3/d3/star" class="unstarred" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="C1oz9ZrvjvN+s0Zrbgbhpv+57dc3FZ7+EML5qA37VbfeTHZyIQJ8vboU7LI/ApSLScylvA/TQjX5Se5N4srJew=="></div>
      <button type="submit" class="btn btn-sm btn-with-count js-toggler-target" aria-label="Star this repository" title="Star d3/d3" data-ga-click="Repository, click star button, action:wiki#show; text:Star">
        <svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"></path></svg>
        Star
      </button>
        <a class="social-count js-social-count" href="https://github.com/d3/d3/stargazers" aria-label="59436 users starred this repository">
          59,436
        </a>
</form>  </div>

  </li>

  <li>
          <!-- '"` --><!-- </textarea></xmp> --><form accept-charset="UTF-8" action="https://github.com/d3/d3/fork" class="btn-with-count" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"><input name="authenticity_token" type="hidden" value="KpxCjbY2isIygUZyD+P5i56Viu6LlBEmSbizZANklNPM5uwh9h9ot3Jmvt1OpFiwoc4Gv3pbC8pv4u8UA2A5Fw=="></div>
            <button type="submit" class="btn btn-sm btn-with-count" data-ga-click="Repository, show fork modal, action:wiki#show; text:Fork" title="Fork your own copy of d3/d3 to your account" aria-label="Fork your own copy of d3/d3 to your account">
              <svg aria-hidden="true" class="octicon octicon-repo-forked" height="16" version="1.1" viewBox="0 0 10 16" width="10"><path fill-rule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
              Fork
            </button>
</form>
    <a href="https://github.com/d3/d3/network" class="social-count" aria-label="15846 users forked this repository">
      15,846
    </a>
  </li>
</ul>

    <h1 class="public ">
  <svg aria-hidden="true" class="octicon octicon-repo" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M4 9H3V8h1v1zm0-3H3v1h1V6zm0-2H3v1h1V4zm0-2H3v1h1V2zm8-1v12c0 .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 10H1v2h2v-1h3v1h5v-2zm0-10H2v9h9V1z"></path></svg>
  <span class="author" itemprop="author"><a href="https://github.com/d3" class="url fn" rel="author">d3</a></span><!--
--><span class="path-divider">/</span><!--
--><strong itemprop="name"><a href="https://github.com/d3/d3" data-pjax="#js-repo-pjax-container">d3</a></strong>

</h1>

  </div>
  <div class="container">
    
<nav class="reponav js-repo-nav js-sidenav-container-pjax" itemscope="" itemtype="http://schema.org/BreadcrumbList" role="navigation" data-pjax="#js-repo-pjax-container">

  <span itemscope="" itemtype="http://schema.org/ListItem" itemprop="itemListElement">
    <a href="https://github.com/d3/d3" class="js-selected-navigation-item reponav-item" data-hotkey="g c" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches /d3/d3" itemprop="url">
      <svg aria-hidden="true" class="octicon octicon-code" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"></path></svg>
      <span itemprop="name">Code</span>
      <meta itemprop="position" content="1">
</a>  </span>

    <span itemscope="" itemtype="http://schema.org/ListItem" itemprop="itemListElement">
      <a href="https://github.com/d3/d3/issues" class="js-selected-navigation-item reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /d3/d3/issues" itemprop="url">
        <svg aria-hidden="true" class="octicon octicon-issue-opened" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
        <span itemprop="name">Issues</span>
        <span class="counter">0</span>
        <meta itemprop="position" content="2">
</a>    </span>

  <span itemscope="" itemtype="http://schema.org/ListItem" itemprop="itemListElement">
    <a href="https://github.com/d3/d3/pulls" class="js-selected-navigation-item reponav-item" data-hotkey="g p" data-selected-links="repo_pulls /d3/d3/pulls" itemprop="url">
      <svg aria-hidden="true" class="octicon octicon-git-pull-request" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
      <span itemprop="name">Pull requests</span>
      <span class="counter">0</span>
      <meta itemprop="position" content="3">
</a>  </span>

  <a href="https://github.com/d3/d3/projects" class="js-selected-navigation-item reponav-item" data-selected-links="repo_projects new_repo_project repo_project /d3/d3/projects">
    <svg aria-hidden="true" class="octicon octicon-project" height="16" version="1.1" viewBox="0 0 15 16" width="15"><path fill-rule="evenodd" d="M10 12h3V2h-3v10zm-4-2h3V2H6v8zm-4 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"></path></svg>
    Projects
    <span class="counter">0</span>
</a>
    <a href="https://github.com/d3/d3/wiki" class="js-selected-navigation-item selected reponav-item" data-hotkey="g w" data-selected-links="repo_wiki /d3/d3/wiki">
      <svg aria-hidden="true" class="octicon octicon-book" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M3 5h4v1H3V5zm0 3h4V7H3v1zm0 2h4V9H3v1zm11-5h-4v1h4V5zm0 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"></path></svg>
      Wiki
</a>

  <a href="https://github.com/d3/d3/pulse" class="js-selected-navigation-item reponav-item" data-selected-links="pulse /d3/d3/pulse">
    <svg aria-hidden="true" class="octicon octicon-pulse" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M11.5 8L8.8 5.4 6.6 8.5 5.5 1.6 2.38 8H0v2h3.6l.9-1.8.9 5.4L9 8.5l1.6 1.5H14V8z"></path></svg>
    Pulse
</a>
  <a href="https://github.com/d3/d3/graphs" class="js-selected-navigation-item reponav-item" data-selected-links="repo_graphs repo_contributors /d3/d3/graphs">
    <svg aria-hidden="true" class="octicon octicon-graph" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M16 14v1H0V0h1v14h15zM5 13H3V8h2v5zm4 0H7V3h2v10zm4 0h-2V6h2v7z"></path></svg>
    Graphs
</a>

</nav>

  </div>
</div>

<div class="container new-discussion-timeline experiment-repo-nav">
  <div class="repository-content">

    

<div id="wiki-wrapper" class="wiki-wrapper page">
<div class="gh-header">
  <div class="gh-header-show">
        <div class="gh-header-actions">
          <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84/_edit" class="btn btn-sm ">Edit</a>
          <a href="https://github.com/d3/d3/wiki/_new" class="btn btn-sm btn-primary">New Page</a>
        </div>
    <h1 class="gh-header-title instapaper_title">数组</h1>
      <div class="gh-header-meta">
        Howard Liang edited this page <relative-time datetime="2015-11-27T20:41:47Z" title="2015年11月28日 GMT+8上午4:41">on 28 Nov 2015</relative-time>
        ·
        <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84/_history" class="history">
          8 revisions
        </a>
      </div>
  </div>
</div>
<div id="wiki-content" class="wiki-content">
  <div class="has-rightbar">

  <div id="wiki-rightbar" class="wiki-rightbar">
    <div class="wiki-pages-box readability-sidebar boxed-group flush js-wiki-pages-box " role="navigation">
      
<h3 class="js-wiki-toggle-collapse wiki-auxiliary-content">
  <svg aria-hidden="true" class="octicon octicon-triangle-down caret-expanded" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M0 5l6 6 6-6z"></path></svg>
  <svg aria-hidden="true" class="octicon octicon-triangle-right caret-collapsed" height="16" version="1.1" viewBox="0 0 6 16" width="6"><path fill-rule="evenodd" d="M0 14l6-6-6-6z"></path></svg>
  Pages <span class="counter">116</span>
</h3>
<div class="boxed-group-inner wiki-auxiliary-content wiki-auxiliary-content-no-bg">
    <div class="filter-bar">
      <input type="text" id="wiki-pages-filter" class="form-control input-sm input-block js-filterable-field" placeholder="Find a Page…" aria-label="Find a Page…" tabindex="2">
    </div>

  <ul class="wiki-pages" data-filterable-for="wiki-pages-filter" data-filterable-type="substring">
    <li>
      <strong><a href="https://github.com/d3/d3/wiki" class="wiki-page-link">Home</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/3.0" class="wiki-page-link">3.0</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/3.1" class="wiki-page-link">3.1</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/API--%E4%B8%AD%E6%96%87%E6%89%8B%E5%86%8C" class="wiki-page-link">API  中文手册</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/API-Reference" class="wiki-page-link">API Reference</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/API-Reference-(%D1%80%D1%83%D1%81%D1%81%D0%BA%D0%BE%D1%8F%D0%B7%D1%8B%D1%87%D0%BD%D0%B0%D1%8F-%D0%B2%D0%B5%D1%80%D1%81%D0%B8%D1%8F)" class="wiki-page-link">API Reference (русскоязычная версия)</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/API-%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9" class="wiki-page-link">API リファレンス</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Arrays" class="wiki-page-link">Arrays</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Behaviors" class="wiki-page-link">Behaviors</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Bundle-Layout" class="wiki-page-link">Bundle Layout</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Chord-Layout" class="wiki-page-link">Chord Layout</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Cluster-Layout" class="wiki-page-link">Cluster Layout</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/CN-Home" class="wiki-page-link">CN Home</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Colors" class="wiki-page-link">Colors</a></strong>
    </li>
    <li>
      <strong><a href="https://github.com/d3/d3/wiki/Core" class="wiki-page-link">Core</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/CSV" class="wiki-page-link">CSV</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/CSV%E6%A0%BC%E5%BC%8F%E5%8C%96" class="wiki-page-link">CSV格式化</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Drag-Behavior" class="wiki-page-link">Drag Behavior</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Force-Layout" class="wiki-page-link">Force Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Formatting" class="wiki-page-link">Formatting</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Gallery" class="wiki-page-link">Gallery</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Geo" class="wiki-page-link">Geo</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Geo-Paths" class="wiki-page-link">Geo Paths</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Geo-Projections" class="wiki-page-link">Geo Projections</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Geo-Streams" class="wiki-page-link">Geo Streams</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Geometry" class="wiki-page-link">Geometry</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Hierarchy-Layout" class="wiki-page-link">Hierarchy Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Histogram-Layout" class="wiki-page-link">Histogram Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Hull-Geom" class="wiki-page-link">Hull Geom</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/ID-Home" class="wiki-page-link">ID Home</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Internals" class="wiki-page-link">Internals</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/JP-3.0" class="wiki-page-link">JP 3.0</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/JP-API-Reference" class="wiki-page-link">JP API Reference</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/JP-Home" class="wiki-page-link">JP Home</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/JP-Tutorials" class="wiki-page-link">JP Tutorials</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Layouts" class="wiki-page-link">Layouts</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Learning-paths" class="wiki-page-link">Learning paths</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Localization" class="wiki-page-link">Localization</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Math" class="wiki-page-link">Math</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Namespaces" class="wiki-page-link">Namespaces</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Ordinal-Scales" class="wiki-page-link">Ordinal Scales</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Pack-Layout" class="wiki-page-link">Pack Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Partition-Layout" class="wiki-page-link">Partition Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Pie-Layout" class="wiki-page-link">Pie Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Plugins" class="wiki-page-link">Plugins</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Polygon-Geom" class="wiki-page-link">Polygon Geom</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Quadtree-Geom" class="wiki-page-link">Quadtree Geom</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Quantitative-Scales" class="wiki-page-link">Quantitative Scales</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Release-Notes" class="wiki-page-link">Release Notes</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Requests" class="wiki-page-link">Requests</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Scales" class="wiki-page-link">Scales</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Selection-(russians)" class="wiki-page-link">Selection (russians)</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Selections" class="wiki-page-link">Selections</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Stack-Layout" class="wiki-page-link">Stack Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG" class="wiki-page-link">SVG</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-Axes" class="wiki-page-link">SVG Axes</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-Controls" class="wiki-page-link">SVG Controls</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-Events" class="wiki-page-link">SVG Events</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-Shapes" class="wiki-page-link">SVG Shapes</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-%E5%BD%A2%E7%8A%B6" class="wiki-page-link">SVG 形状</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-%E6%8E%A7%E4%BB%B6" class="wiki-page-link">SVG 控件</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG-%E8%BD%B4" class="wiki-page-link">SVG 轴</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/SVG%E5%87%BD%E6%95%B0" class="wiki-page-link">SVG函数</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Time" class="wiki-page-link">Time</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Time-Formatting" class="wiki-page-link">Time Formatting</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Time-Intervals" class="wiki-page-link">Time Intervals</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Time-Scales" class="wiki-page-link">Time Scales</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Transitions" class="wiki-page-link">Transitions</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Tree-Layout" class="wiki-page-link">Tree Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Treemap-Layout" class="wiki-page-link">Treemap Layout</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Tutorials" class="wiki-page-link">Tutorials</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/TW-Home" class="wiki-page-link">TW Home</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Upgrading-to-3.0" class="wiki-page-link">Upgrading to 3.0</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Voronoi-Geom" class="wiki-page-link">Voronoi Geom</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/Zoom-Behavior" class="wiki-page-link">Zoom Behavior</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%D0%92%D1%8B%D0%B1%D0%BE%D1%80%D0%BA%D0%B8" class="wiki-page-link">Выборки</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%86%85%E9%83%A8" class="wiki-page-link">内部</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%87%A0%E4%BD%95" class="wiki-page-link">几何</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%88%86%E5%8C%BA%E5%B8%83%E5%B1%80" class="wiki-page-link">分区布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%8A%9B%E5%B8%83%E5%B1%80" class="wiki-page-link">力布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%8C%85%E5%B8%83%E5%B1%80" class="wiki-page-link">包布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4" class="wiki-page-link">命名空间</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%9B%9B%E5%8F%89%E6%A0%91" class="wiki-page-link">四叉树</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%9C%B0%E7%90%86" class="wiki-page-link">地理</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%9C%B0%E7%90%86%E6%8A%95%E5%BD%B1" class="wiki-page-link">地理投影</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%9C%B0%E7%90%86%E8%B7%AF%E5%BE%84" class="wiki-page-link">地理路径</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%A0%86%E5%8F%A0%E5%B8%83%E5%B1%80" class="wiki-page-link">堆叠布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%A4%9A%E8%BE%B9%E5%BD%A2" class="wiki-page-link">多边形</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%B1%82%E6%AC%A1%E5%B8%83%E5%B1%80" class="wiki-page-link">层次布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%B8%83%E5%B1%80" class="wiki-page-link">布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%BA%8F%E6%95%B0%E6%AF%94%E4%BE%8B%E5%B0%BA" class="wiki-page-link">序数比例尺</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E5%BC%A6%E5%B8%83%E5%B1%80" class="wiki-page-link">弦布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%8B%96%E5%8A%A8" class="wiki-page-link">拖动</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%8D%86%E5%B8%83%E5%B1%80" class="wiki-page-link">捆布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%8D%86%E7%BB%91%E5%B8%83%E5%B1%80" class="wiki-page-link">捆绑布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%80%BC%E6%AF%94%E4%BE%8B%E5%B0%BA" class="wiki-page-link">数值比例尺</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%95%B0%E5%AD%A6" class="wiki-page-link">数学</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="数组 · d3_d3 Wiki_files/数组 · d3_d3 Wiki.html" class="wiki-page-link">数组</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%97%B6%E9%97%B4%E6%AF%94%E4%BE%8B%E5%B0%BA" class="wiki-page-link">时间比例尺</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%9C%AC%E5%9C%B0%E5%8C%96" class="wiki-page-link">本地化</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%A0%91%E5%B8%83%E5%B1%80" class="wiki-page-link">树布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%A0%B8%E5%BF%83%E5%87%BD%E6%95%B0" class="wiki-page-link">核心函数</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%A0%BC%E5%BC%8F%E5%8C%96" class="wiki-page-link">格式化</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%AF%94%E4%BE%8B%E5%B0%BA" class="wiki-page-link">比例尺</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E6%B3%B0%E6%A3%AE%E5%A4%9A%E8%BE%B9%E5%BD%A2" class="wiki-page-link">泰森多边形</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E7%9B%B4%E6%96%B9%E5%9B%BE%E5%B8%83%E5%B1%80" class="wiki-page-link">直方图布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E7%9F%A9%E5%BD%A2%E6%A0%91%E5%B8%83%E5%B1%80" class="wiki-page-link">矩形树布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E7%B0%87%E5%B8%83%E5%B1%80" class="wiki-page-link">簇布局</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E7%BC%A9%E6%94%BE" class="wiki-page-link">缩放</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E8%A1%8C%E4%B8%BA" class="wiki-page-link">行为</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E8%AF%B7%E6%B1%82" class="wiki-page-link">请求</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E8%B5%AB%E5%B0%94" class="wiki-page-link">赫尔</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E8%BF%87%E6%B8%A1" class="wiki-page-link">过渡</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E9%80%89%E6%8B%A9%E5%99%A8" class="wiki-page-link">选择器</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E9%A2%9C%E8%89%B2" class="wiki-page-link">颜色</a></strong>
    </li>
    <li class="wiki-more-pages">
      <strong><a href="https://github.com/d3/d3/wiki/%E9%A5%BC%E5%B8%83%E5%B1%80" class="wiki-page-link">饼布局</a></strong>
    </li>
    <li class="wiki-more-pages-link">
      <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#" class="js-wiki-more-pages-link">
        Show 101 more pages…
      </a>
    </li>
  </ul>
</div>

    </div>


    <div class="clone-url">
      <h5>Clone this wiki locally</h5>
      <div class="input-group js-zeroclipboard-container">
        <input type="text" class="form-control input-sm text-small text-gray input-monospace js-url-field js-zeroclipboard-target" aria-label="Clone URL for this wiki" value="https://github.com/d3/d3.wiki.git" readonly="readonly">
        <span class="input-group-button">
          <button aria-label="Copy to clipboard" class="js-zeroclipboard btn btn-sm zeroclipboard-button tooltipped tooltipped-s" data-copied-hint="Copied!" type="button"><svg aria-hidden="true" class="octicon octicon-clippy" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M2 13h4v1H2v-1zm5-6H2v1h5V7zm2 3V8l-3 3 3 3v-2h5v-2H9zM4.5 9H2v1h2.5V9zM2 12h2.5v-1H2v1zm9 1h1v2c-.02.28-.11.52-.3.7-.19.18-.42.28-.7.3H1c-.55 0-1-.45-1-1V4c0-.55.45-1 1-1h3c0-1.11.89-2 2-2 1.11 0 2 .89 2 2h3c.55 0 1 .45 1 1v5h-1V6H1v9h10v-2zM2 5h8c0-.55-.45-1-1-1H8c-.55 0-1-.45-1-1s-.45-1-1-1-1 .45-1 1-.45 1-1 1H3c-.55 0-1 .45-1 1z"></path></svg></button>
        </span>
      </div>


        <a href="https://windows.github.com/" class="btn btn-sm sidebar-button" title="Save this wiki to your computer and use it in GitHub Desktop." aria-label="Save this wiki to your computer and use it in GitHub Desktop.">
          <svg aria-hidden="true" class="octicon octicon-desktop-download" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 6h3V0h2v6h3l-4 4-4-4zm11-4h-4v1h4v8H1V3h4V2H1c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5.34c-.25.61-.86 1.39-2.34 2h8c-1.48-.61-2.09-1.39-2.34-2H15c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1z"></path></svg>
          Clone in Desktop
        </a>
    </div>
  </div>

  <div id="wiki-body" class="wiki-body gollum-markdown-content instapaper_body">
      <div class="markdown-body">
        <blockquote>
<p><a href="https://github.com/d3/d3/wiki/Home">Wiki</a> ▸ <a class="internal present" href="https://github.com/d3/d3/wiki/API--%E4%B8%AD%E6%96%87%E6%89%8B%E5%86%8C">API--中文手册</a> ▸ <a class="internal present" href="https://github.com/d3/d3/wiki/%E6%A0%B8%E5%BF%83%E5%87%BD%E6%95%B0">核心函数</a> ▸ <strong>数组</strong></p>
</blockquote>

<ul>
<li>如发现翻译不当或有其他问题可以通过以下方式联系译者:</li>
<li>邮箱：<a href="mailto:zhang_tianxu@sina.com">zhang_tianxu@sina.com</a>
</li>
<li>QQ群：<a href="http://jq.qq.com/?_wv=1027&amp;k=ZGcqYF">D3数据可视化</a>205076374，<a href="http://jq.qq.com/?_wv=1027&amp;k=S8wGMe">大数据可视化</a>436442115</li>
</ul>

<p>当你使用D3处理数据可视化时，通常会倾向于做大量的<strong>数组操作(array manipulation)</strong>。那是因为数组是D3的标准的数据呈现形式。数组处理的一些常见形式包括：取数组的一个连续片段（子集），使用判定函数过滤数组，使用变换函数映射数组为一组平行的值。在看到D3框架提供的一系列方法处理数组时，你应当很熟悉强大的<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype" title="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/prototype">JavaScript内置的数组的方法</a>.</p>

<p>JavaScript包含修改数组的<strong>赋值方法(mutator methods)</strong>：</p>

<ul>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop">array.pop</a> -删除数组最后一位元素。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push">array.push</a> - 往数组的末尾新增一个或多个元素。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse">array.reverse</a> - 把数组元素的逆转顺序。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift">array.shift</a> - 删除数组第一位元素。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort">array.sort</a> - 给数组排序。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice">array.splice</a> - 给数组添加或者删除元素。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift">array.unshift</a> - 往数组的第一位新增一个或多个元素。</li>
</ul>

<p>还有一些数组的<strong><a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#accessor">存取方法(accessor methods)</a></strong>，返回数组的一些描述:</p>

<ul>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat">array.concat</a> - 合并数组或合并数组的值。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join">array.join</a> - 合并数组所有元素拼接成字符串。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice">array.slice</a> - 提取数组的一个选择。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf">array.indexOf</a> - 定位到数组第一个值。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf">array.lastIndexOf</a> - 定位到数组内最后一个值。</li>
</ul>

<p>最后，对数组中的元素使用用函数的<strong>迭代方法(iteration methods)</strong>:</p>

<ul>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter">array.filter</a> - 由满足特定条件的元素创建一个新的数组。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach">array.forEach</a> - 为数组中每一个元素调用一个函数。</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every">array.every</a> - See if every element in the array satisfies a predicate.</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map">array.map</a> - Create a new array with the result of calling a function on every element in the array.</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some">array.some</a> - See if at least one element in the array satisfies a predicate.</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce">array.reduce</a> - Apply a function to reduce the array to a single value (from left-to-right).</li>
<li>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight">array.reduceRight</a> - Apply a function to reduce the array to a single value (from right-to-left).</li>
</ul>

<h2>
<a id="user-content-排序-ordering" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#%E6%8E%92%E5%BA%8F-ordering" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>排序 （Ordering）</h2>

<p><a name="user-content-d3_ascending" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_ascending">#</a> d3.<strong>ascending</strong>(<em>a</em>, <em>b</em>)</p>

<p>如果<code>a &lt; b</code>返回-1，<code>a &gt; b</code>返回1，<code>a = b</code>返回0。
这是固有的比较器方法，也可用于关联内置数组排序的方法来给元素升序排序：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">function</span> <span class="pl-en">ascending</span>(<span class="pl-smi">a</span>, <span class="pl-smi">b</span>) {
  <span class="pl-k">return</span> a <span class="pl-k">&lt;</span> b <span class="pl-k">?</span> <span class="pl-k">-</span><span class="pl-c1">1</span> <span class="pl-k">:</span> a <span class="pl-k">&gt;</span> b <span class="pl-k">?</span> <span class="pl-c1">1</span> <span class="pl-k">:</span> a <span class="pl-k">&gt;=</span> b <span class="pl-k">?</span> <span class="pl-c1">0</span> <span class="pl-k">:</span> <span class="pl-c1">NaN</span>;
}</pre></div>

<p>注意，如果没有给数组的内置排序方法没有指定比较器函数，那默认的排序是字典排序(按字母顺序排序)，而非自然排列！所以当以数组的数字来排序时会导致bug。</p>

<p><a name="user-content-d3_descending" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_descending">#</a> d3.<strong>descending</strong>(<em>a</em>, <em>b</em>)</p>

<p>如果<code>a &gt; b</code>返回-1，<code>a &lt; b</code>返回1，<code>a = b</code>返回0。
这是固有的比较器方法，也可用于关联内置数组排序的方法来给元素降序排序：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">function</span> <span class="pl-en">descending</span>(<span class="pl-smi">a</span>, <span class="pl-smi">b</span>) {
  <span class="pl-k">return</span> b <span class="pl-k">&lt;</span> a <span class="pl-k">?</span> <span class="pl-k">-</span><span class="pl-c1">1</span> <span class="pl-k">:</span> b <span class="pl-k">&gt;</span> a <span class="pl-k">?</span> <span class="pl-c1">1</span> <span class="pl-k">:</span> b <span class="pl-k">&gt;=</span> a <span class="pl-k">?</span> <span class="pl-c1">0</span> <span class="pl-k">:</span> <span class="pl-c1">NaN</span>;
}</pre></div>

<p>注意，如果没有给数组的内置排序方法没有指定比较器函数，那默认的排序是字典排序(按字母顺序排序)，而非自然排列！所以当以数组的数字来排序时会导致bug。</p>

<p><a name="user-content-d3_min" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_min">#</a> d3.<strong>min</strong>(<em>array</em>[, <em>accessor</em>])</p>

<p>返回给定数组（array）中自然排序最小的值。如果数组为空，返回undefined。如果指定了accessor 参数，等同与在计算最小值之前调用了array.map(accessor)方法。不同于内置的<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/min" title="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Math/min">Math.min</a>，这个方法会忽略未定义的值；这对比例尺(<a class="internal present" href="https://github.com/d3/d3/wiki/%E6%AF%94%E4%BE%8B%E5%B0%BA">d3.scale</a>)定义域计算很有用处，当只考虑数据的定义区域。另外，元素的比较用的是自然排序而不是数字排序。例如，["20","3"]的最小值是20，然而[20,3]的最小值是3。</p>

<p><a name="user-content-d3_max" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_max">#</a> d3.<strong>max</strong>(<em>array</em>[, <em>accessor</em>])</p>

<p>返回给定数组（array）中自然排序最大的值。如果数组为空，返回undefined。如果指定了accessor 参数，等同与在计算最大值之前调用了array.map(accessor)方法。而并非内置的Math.max，这个方法会忽略未定义的值；这对当只需要定义数据的区域的比例尺定义域计算很有用处。另外，元素的比较用的是自然排序而不是数字排序。例如，["20","3"]的最大值是3，然而[20,3]的最大值是20。</p>

<p><a name="user-content-d3_extent" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_extent">#</a> d3.<strong>extent</strong>(<em>array</em>[, <em>accessor</em>])</p>

<p>返回给定数组（array）自然排序的最小值和最大值，等同于同时调用<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_min">d3.min</a>和<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_max">d3.max</a>.</p>

<p><a name="user-content-d3_sum" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_sum">#</a> d3.<strong>sum</strong>(<em>array</em>[, <em>accessor</em>])</p>

<p>返回给定数组（array）的和。如果数组为空，返回 0。可选参数accessor函数 被指定，等同于在计算和之前调用<em>array.map(accessor)</em> 。此方法忽略无效值(如<code>NaN</code> 和<code>undefined</code>)；当只考虑明确定义的值时，这个方法可用于计算数据的和。</p>

<p><a name="user-content-d3_mean" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_mean">#</a> d3.<strong>mean</strong>(<em>array</em>[, <em>accessor</em>])</p>

<p>返回给定数组（array）的平均数。如果数组为空，返回 <code>undefined</code>。可选参数accessor函数 被指定，等同在计算平均数之前调用<em>array.map(accessor)</em> 。此方法忽略无效值(如<code>NaN</code> 和<code>undefined</code>)，当只考虑明确定义的值时这个方法计算数据和是很有用的。</p>

<p><a name="user-content-d3_median" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_median">#</a> d3.<strong>median</strong>(<em>array</em>[, <em>accessor</em>])</p>

<p>返回给定数组（array）以<a href="http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population" title="http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population">R-7算法</a>得出的中位数。如果数组为空，返回 undefined。可选参数accessor 被指定，等同在计算中位数之前调用<em>array.map(accessor)</em> 。此方法忽略无效值(如<code>NaN</code> 和<code>undefined</code>) ，当只考虑明确定义的值时这个方法计算数据和是很有用的。</p>

<p><a name="user-content-d3_quantile" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_quantile">#</a> d3.<strong>quantile</strong>(<em>numbers</em>, <em>p</em>)</p>

<p>返回给定数组<em>numbers</em>的<em>p</em>分位数，其中p 是一个0到1范围的数。例如，中位数可以由p = 0.5计算，第一个四分位数是p = 0.25，第三个四分位数是p = 0.75。这个特别实现了<a href="http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population" title="http://en.wikipedia.org/wiki/Quantile#Quantiles_of_a_population">R-7算法</a>，这是R编程语言和Excel默认的方式。这个方法需要数组numbers包含数字且数字升序顺序排列，例如使用 <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_ascending">d3.ascending</a>排序。</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> a <span class="pl-k">=</span> [<span class="pl-c1">0</span>, <span class="pl-c1">1</span>, <span class="pl-c1">3</span>];
<span class="pl-smi">d3</span>.<span class="pl-en">quantile</span>(a, <span class="pl-c1">0</span>); <span class="pl-c"><span class="pl-c">//</span> return 0</span>
<span class="pl-smi">d3</span>.<span class="pl-en">quantile</span>(a, <span class="pl-c1">0.5</span>); <span class="pl-c"><span class="pl-c">//</span> return 1</span>
<span class="pl-smi">d3</span>.<span class="pl-en">quantile</span>(a, <span class="pl-c1">1</span>); <span class="pl-c"><span class="pl-c">//</span> return 3</span>
<span class="pl-smi">d3</span>.<span class="pl-en">quantile</span>(a, <span class="pl-c1">0.25</span>); <span class="pl-c"><span class="pl-c">//</span> return 0.5</span>
<span class="pl-smi">d3</span>.<span class="pl-en">quantile</span>(a, <span class="pl-c1">0.75</span>); <span class="pl-c"><span class="pl-c">//</span> return 2</span>
<span class="pl-smi">d3</span>.<span class="pl-en">quantile</span>(a, <span class="pl-c1">0.1</span>); <span class="pl-c"><span class="pl-c">//</span> return 0.19999999999999996 </span></pre></div>

<p><a name="user-content-d3_variance" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_variance">#</a> d3.<strong>variance</strong>(<em>array</em>[, <em>accessor</em>])</p>

<p>返回给定数组（array）的无偏总体方差（<a href="http://mathworld.wolfram.com/SampleVariance.html%20%E2%80%9Chttp://mathworld.wolfram.com/SampleVariance.html%E2%80%9D">unbiased estimator of the population variance</a>）。如果数组的长度小于2，返回<code>undefined</code>。可选参数accessor 被指定，等同在计算中位数之前调用<em>array.map(accessor)</em> 。此方法忽略无效值(如<code>NaN</code> 和<code>undefined</code>)。</p>

<p><a name="user-content-d3_deviation" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_deviation">#</a> d3.<strong>deviation</strong>(<em>array</em>[, <em>accessor</em>])</p>

<p>返回给定数组（array）的标准差，即方差（<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_variance">bias-corrected variance</a>）的平方根。如果数组的长度小于2，返回<code>undefined</code>。可选参数accessor 被指定，等同在计算中位数之前调用<em>array.map(accessor)</em> 。此方法忽略无效值(如<code>NaN</code> 和<code>undefined</code>)。</p>

<p><a name="user-content-d3_bisectLeft" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_bisectLeft">#</a> d3.<strong>bisectLeft</strong>(<em>array</em>, <em>x</em>[, <em>lo</em>[, <em>hi</em>]])</p>

<p>定位数组 <em>array</em> 中的 <em>x</em> 的插入点，以保持已有序列。参数 <em>lo</em> 和 <em>hi</em> 用来指定数组的子集；默认情况下整个数组都被使用。如果 <em>x</em> 在 <em>array</em> 中已存在，插入点在所有元素之前（左侧）。返回值适合用作拼接（<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice">splice</a>）<em>已经排序的</em>数组<em>array</em> 的第一个参数。返回的插入点<em>i</em>把<em>array</em> 分为两个区：数组中所有<em>array</em>.slice(lo, i)中<code>v &lt; x</code> 的v在左边，数组中所有 <em>array</em>.slice(i, hi)中<code>v &gt;= x</code> 的v在右边。</p>

<p><a name="user-content-d3_bisect" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_bisect">#</a> d3.<strong>bisect</strong>(<em>array</em>, <em>x</em>[, <em>lo</em>[, <em>hi</em>]])
<a name="user-content-d3_bisectRight" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_bisectRight">#</a> d3.<strong>bisectRight</strong>(<em>array</em>, <em>x</em>[, <em>lo</em>[, <em>hi</em>]])</p>

<p>和bisectLeft类似，但返回插入点来自于数组<em>array</em>中任意实体<em>x</em>之后（右侧）。返回的插入点<em>i</em>把<em>array</em> 分为两个区：数组中所有<em>array</em>.slice(lo, i)中<code>v &lt;= x</code>的v在左边，数组中所有 <em>array</em>.slice(i, hi)中<code>v &gt; x</code> 的v在右边。</p>

<p><a name="user-content-d3_bisector" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_bisector">#</a> d3.<strong>bisector</strong>(<em>accessor</em>)
<br><a name="user-content-d3_bisector" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_bisector">#</a> d3.<strong>bisector</strong>(<em>comparator</em>)</p>

<p>使用指定参数<em>accessor</em>或者<em>comparator</em> 函数返回一个二等分线。返回的对象有<code>left</code> 和<code>right</code> 属性，分别类似于<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_bisectLeft">bisectLeft</a>和<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_bisectRight">bisectRight</a>方法。这个方法能用于二等分对象数组而不适用于原始的简单数组。例如下列对象的数组:</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> data <span class="pl-k">=</span> [
  {date<span class="pl-k">:</span> <span class="pl-k">new</span> <span class="pl-en">Date</span>(<span class="pl-c1">2011</span>,  <span class="pl-c1">1</span>, <span class="pl-c1">1</span>), value<span class="pl-k">:</span> <span class="pl-c1">0.5</span>},
  {date<span class="pl-k">:</span> <span class="pl-k">new</span> <span class="pl-en">Date</span>(<span class="pl-c1">2011</span>,  <span class="pl-c1">2</span>, <span class="pl-c1">1</span>), value<span class="pl-k">:</span> <span class="pl-c1">0.6</span>},
  {date<span class="pl-k">:</span> <span class="pl-k">new</span> <span class="pl-en">Date</span>(<span class="pl-c1">2011</span>,  <span class="pl-c1">3</span>, <span class="pl-c1">1</span>), value<span class="pl-k">:</span> <span class="pl-c1">0.7</span>},
  {date<span class="pl-k">:</span> <span class="pl-k">new</span> <span class="pl-en">Date</span>(<span class="pl-c1">2011</span>,  <span class="pl-c1">4</span>, <span class="pl-c1">1</span>), value<span class="pl-k">:</span> <span class="pl-c1">0.8</span>}
];</pre></div>

<p>一个合适的二等分函数可定义为：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> bisect <span class="pl-k">=</span> <span class="pl-smi">d3</span>.<span class="pl-en">bisector</span>(<span class="pl-k">function</span>(<span class="pl-smi">d</span>) { <span class="pl-k">return</span> <span class="pl-smi">d</span>.<span class="pl-smi">date</span>; }).<span class="pl-c1">right</span>;</pre></div>

<p>然后调用<code>bisect(data, new Date(2011, 1, 2))</code>，返回索引。
如果你想使用不同于自然排序的方法对值进行排序，那么可以使用比较器（comparator）而不是访问器（accessor），例如降序排序而不是升序排序的时候。</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> bisect <span class="pl-k">=</span> <span class="pl-smi">d3</span>.<span class="pl-en">bisector</span>(<span class="pl-k">function</span>(<span class="pl-smi">a</span>, <span class="pl-smi">b</span>) { <span class="pl-k">return</span> <span class="pl-smi">a</span>.<span class="pl-smi">date</span> <span class="pl-k">-</span> <span class="pl-smi">b</span>.<span class="pl-smi">date</span>; }).<span class="pl-c1">right</span>;</pre></div>

<p><a name="user-content-d3_shuffle" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_shuffle">#</a> d3.<strong>shuffle</strong>(<em>array</em>[, <em>lo</em>[, <em>hi</em>]])</p>

<p>使用<a href="http://bost.ocks.org/mike/shuffle/">Fisher–Yates shuffle</a>来把传入参数<em>array</em>随机排序.</p>

<h2>
<a id="user-content-关联数组-associative-arrays" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#%E5%85%B3%E8%81%94%E6%95%B0%E7%BB%84-associative-arrays" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>关联数组 （Associative Arrays）</h2>

<p>关联数组(字典)和数组类似，由以名称作为键的字段和方法组成。
它包含标量数据，可用索引值来单独选择这些数据，和数组不同的是， 关联数组的索引值不是非负的整数而是任意的标量。这些标量称为Keys，可以在以后用于检索数组中的数值.
JavaScript 中另一种常见数据类型就是关联数组，或者简单说就是具有一系列命名属性的对象。在Java中简称映射(键值对) map，而在Python中称为字典dictionary。JavaScript为关联数组中键（属性名称）的迭代提供一个标准机制：那就是 <a href="https://developer.mozilla.org/en/JavaScript/Reference/Statements/for...in">for…in loop</a>。然而，注意迭代的次序是未定义的。D3提供了一些将关联数组转化为索引数组的方法。</p>

<p><a name="user-content-d3_keys" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_keys">#</a> d3.<strong>keys</strong>(<em>object</em>)</p>

<p>返回一个包含指定对象(关联数组) 属性名称的数组。返回数组的顺序未定义。</p>

<p><a name="user-content-d3_values" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_values">#</a> d3.<strong>values</strong>(<em>object</em>)</p>

<p>返回一个包含指定对象(关联数组) 属性值的数组。返回数组的顺序未定义。</p>

<p><a name="user-content-d3_entries" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_entries">#</a> d3.<strong>entries</strong>(<em>object</em>)</p>

<p>返回一个包含对象(<em>object</em>)(一个关联数组)中名称以及值(键和值， key and value)的数组 (array)。每一个实体都是有键值对的对象，例如<code>{key: "foo", value: 42}</code>。返回数组的顺序未定义。</p>

<div class="highlight highlight-source-js"><pre><span class="pl-smi">d3</span>.<span class="pl-c1">entries</span>({foo<span class="pl-k">:</span> <span class="pl-c1">42</span>， bar<span class="pl-k">:</span> <span class="pl-c1">true</span>}); <span class="pl-c"><span class="pl-c">//</span> returns [{key: "foo", value: 42}]</span></pre></div>

<h3>
<a id="user-content-映射maps" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#%E6%98%A0%E5%B0%84maps" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>映射（Maps）</h3>

<p>当你尝试在JavaScript中用空对象作为map，当内部属性名称(键)作键时，会导致<a href="http://www.devthought.com/2012/01/18/an-object-is-not-a-hash/">意外的行为(unexpected behavior)</a>。比如，当你设置<code>object["__proto__"] = 42</code>时，最终不会达到你理想中的结果。又如你尝试查询给定key是否在map中定义了；"hasOwnProperty" in object 返回true，因为空对象(从对象原型)继承了hasOwnProperty方法。为避免这些问题，ES6提出了<a href="http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets">简单映射和集合(simple maps and sets)</a> 理论。直到现代浏览器支持了这些集合，你可以使用[d3.map]替代.</p>

<p>注意：不同于建议的 ES6 map ，d3.map的key仍然强制使用字符串，而不是严格的相等。</p>

<p><a name="user-content-d3_map" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_map">#</a> d3.<strong>map</strong>([<em>object</em>][, <em>key</em>])</p>

<p>构建一个新的map，如果指定参数<em>object</em>，复制参数<em>object</em>对象内所有枚举属性到map中。参数对象可能是数组. 可以使用一个键<em>key</em>函数来计算数组里每个数值的键. 如下:</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> m <span class="pl-k">=</span> <span class="pl-smi">d3</span>.<span class="pl-en">map</span>([{name<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>foo<span class="pl-pds">"</span></span>}, {name<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>bar<span class="pl-pds">"</span></span>}], <span class="pl-k">function</span>(<span class="pl-smi">d</span>) { <span class="pl-k">return</span> <span class="pl-smi">d</span>.<span class="pl-c1">name</span>; });
<span class="pl-smi">m</span>.<span class="pl-c1">get</span>(<span class="pl-s"><span class="pl-pds">"</span>foo<span class="pl-pds">"</span></span>); <span class="pl-c"><span class="pl-c">//</span> {"name": "foo"}</span>
<span class="pl-smi">m</span>.<span class="pl-c1">get</span>(<span class="pl-s"><span class="pl-pds">"</span>bar<span class="pl-pds">"</span></span>); <span class="pl-c"><span class="pl-c">//</span> {"name": "bar"}</span>
<span class="pl-smi">m</span>.<span class="pl-c1">get</span>(<span class="pl-s"><span class="pl-pds">"</span>baz<span class="pl-pds">"</span></span>); <span class="pl-c"><span class="pl-c">//</span> undefined</span></pre></div>

<p>参见 <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_nest">d3.nest</a>。</p>

<p><a name="user-content-map_has" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_has">#</a> map.<strong>has</strong>(<em>key</em>)</p>

<p>当且仅当map有指定key的实体时返回true。注意：该值可能是<code>null</code> 或<code>undefined</code>。</p>

<p><a name="user-content-map_get" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_get">#</a> map.<strong>get</strong>(<em>key</em>)</p>

<p>返回参数<em>key</em>的值。如果map中没有参数<em>key</em>相同元素，返回<code>undefined</code>。</p>

<p><a name="user-content-map_set" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_set">#</a> map.<strong>set</strong>(<em>key</em>, <em>value</em>)</p>

<p>指定<em>key</em>的<em>value</em> ；返回新的<em>value</em>。如果map之前同样的<em>key</em> 有一个实体了，那么旧实体被新值替代。</p>

<p><a name="user-content-map_remove" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_remove">#</a> map.<strong>remove</strong>(<em>key</em>)</p>

<p>若map有指定<em>key</em>的实体，删除此实体并返回<code>true</code>。否则，此方法不做任何操作，返回<code>false</code>。</p>

<p><a name="user-content-map_keys" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_keys">#</a> map.<strong>keys</strong>()</p>

<p>返回在这个map所有的键的数组。返回键的集合顺序是随机的。</p>

<p><a name="user-content-map_values" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_values">#</a> map.<strong>values</strong>()</p>

<p>返回在这个map所有的值的数组，返回值的集合顺序是随机的。</p>

<p><a name="user-content-map_entries" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_entries">#</a> map.<strong>entries</strong>()</p>

<p>返回一个map内所有键-值对象的数组。返回元素的集合顺序是随机的。任何元素的键必须是字符串类型，但值可为任何类型。</p>

<p><a name="user-content-map_forEach" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_forEach">#</a> map.<strong>forEach</strong>(<em>function</em>)</p>

<p>给map中每个元素调用一个指定函数<em>function</em>，传递元素的键和值作为两个参数。<em>function</em>的使用的<code>this</code>指针将指向这个map。返回<code>undefined</code>。迭代的顺序是随机的。</p>

<p><a name="user-content-map_empty" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_empty">#</a> map.<strong>empty</strong>()</p>

<p>返回<code>true</code>当且仅当map中没有元素。</p>

<p><a name="user-content-map_size" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_size">#</a> map.<strong>size</strong>()</p>

<p>返回map中元素的个数</p>

<h3>
<a id="user-content-集合sets" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#%E9%9B%86%E5%90%88sets" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>集合（Sets）</h3>

<p><a name="user-content-d3_set" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_set">#</a> d3.<strong>set</strong>([<em>array</em>])</p>

<p>新建一个集合，如果指定了<em>array</em> ，添加<em>array</em> 的字符串值到返回集合中。</p>

<p><a name="user-content-set_has" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#set_has">#</a> set.<strong>has</strong>(<em>value</em>)</p>

<p>当且仅当集合中具有指定参数<em>value</em> 字符串相同的实体，返回<code>true</code>。</p>

<p><a name="user-content-set_add" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#set_add">#</a> set.<strong>add</strong>(<em>value</em>)</p>

<p>添加指定参数<em>value</em> 字符串到集合中.</p>

<p><a name="user-content-set_remove" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#set_remove">#</a> set.<strong>remove</strong>(<em>value</em>)</p>

<p>如果集合中含有指定参数<em>value</em> 字符串相同元素，返回<code>true</code>并删除元素。否则，这个方法不做任何操作，并返回<code>false</code>。</p>

<p><a name="user-content-set_values" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#set_values">#</a> set.<strong>values</strong>()</p>

<p>返回一个由集合中所有字符串类型值组成的数组。数组中的值的顺序为随机的。可作为集合中唯一值的简便计算方法(去重)。例如:</p>

<div class="highlight highlight-source-js"><pre><span class="pl-smi">d3</span>.<span class="pl-c1">set</span>([<span class="pl-s"><span class="pl-pds">"</span>foo<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>bar<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>foo<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>baz<span class="pl-pds">"</span></span>]).<span class="pl-c1">values</span>(); <span class="pl-c"><span class="pl-c">//</span> "foo", "bar", "baz"</span></pre></div>

<p><a name="user-content-set_forEach" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#set_forEach">#</a> set.<strong>forEach</strong>(<em>function</em>)</p>

<p>给集合中每个元素调用一个指定<em>function</em>，传递元素的值作为参数。<em>function</em>的使用的<code>this</code>指针将指向这个map。返回<code>undefined</code>，迭代的顺序是随机的。</p>

<p><a name="user-content-set_empty" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#set_empty">#</a> set.<strong>empty</strong>()</p>

<p>当且仅当集合中没有值，返回<code>true</code>。</p>

<p><a name="user-content-set_size" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#set_size">#</a> set.<strong>size</strong>()</p>

<p>返回集合中值的个数。</p>

<h2>
<a id="user-content-数组运算符-array-operators" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#%E6%95%B0%E7%BB%84%E8%BF%90%E7%AE%97%E7%AC%A6-array-operators" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>数组运算符 (Array Operators)</h2>

<p><a name="user-content-d3_merge" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_merge">#</a> d3.<strong>merge</strong>(<em>arrays</em>)</p>

<p>合并指定参数<em>arrays</em> 为一个数组，此方法和数组内置方法<code>concat</code> 类似；唯一不同是当你要处理二维数组时，<code>d3.merge(arrays)</code>方法更方便。</p>

<div class="highlight highlight-source-js"><pre><span class="pl-smi">d3</span>.<span class="pl-en">merge</span>([ [<span class="pl-c1">1</span>], [<span class="pl-c1">2</span>, <span class="pl-c1">3</span>] ]); <span class="pl-c"><span class="pl-c">//</span> returns [1, 2, 3]</span></pre></div>

<p><a name="user-content-d3_range" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_range">#</a> d3.<strong>range</strong>([<em>start</em>, ]<em>stop</em>[, <em>step</em>])</p>

<p>生成一个包含算数级数的数组，类似于Python的内置函数<a href="http://docs.python.org/library/functions.html#range" title="http://docs.python.org/library/functions.html#range">range</a>。这个方法常用来遍历一个数字序列或者整型数值。例如数组中的索引。不同于Python版本，这个参数不必是整形。尽管如果它们是浮点精度类型时这个结果更加可预测。如果省略<em>step</em>，默认值是1。如果省略<em>start</em>参数，默认值就是0。结果中不包含<em>stop</em>值。完整的形式是返回一个数字数组<code>[start,start+step,start+2 *step,…]</code>。如果<em>step</em>是正的，则最后一个元素是小于<code>stop</code>的<code>start+ i*step</code>中的最大数值；如果<em>step</em>是负的，最后一个元素是大于<code>stop</code>的<code>start + i*step</code>中的最小数值。如果返回的数组将包含值无限多数字，就会抛出一个错误，而不是造成无限循环。</p>

<p><a name="user-content-d3_permute" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_permute">#</a> d3.<strong>permute</strong>(<em>array</em>, <em>indexes</em>)</p>

<p>使用指定的<em>indexes</em>数组返回指定数组的转置。返回数组包含indexes数组中索引对应的元素，按顺序。例如，<code>permute(["a", "b", "c"], [1, 2, 0])</code> 返回 <code>["b", "c", "a"]</code>。indexes数组的长度和array中的元素长度不一样是可以接受的，并且允许indexes数组重复或者省略。
这个方法可以用来按固定顺序提取对象中的值到一个数组中。（在JavaScript中indexes数组是和<code>.length</code>有特殊关系的简单属性）。按顺序提取带键的值可以用来生成嵌套选择中的数据数组。例如，我们可以用表格形式展示上述的一些明尼苏达州大麦产量数据：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> cols <span class="pl-k">=</span> [<span class="pl-s"><span class="pl-pds">"</span>site<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>variety<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>yield<span class="pl-pds">"</span></span>];
<span class="pl-smi">thead</span>.<span class="pl-en">selectAll</span>(<span class="pl-s"><span class="pl-pds">'</span>th<span class="pl-pds">'</span></span>).<span class="pl-c1">data</span>(cols)
    .<span class="pl-en">enter</span>().<span class="pl-c1">append</span>(<span class="pl-s"><span class="pl-pds">'</span>th<span class="pl-pds">'</span></span>).<span class="pl-c1">text</span>(<span class="pl-k">function</span> (<span class="pl-smi">d</span>) { <span class="pl-k">return</span> <span class="pl-smi">d</span>.<span class="pl-c1">toUpperCase</span>(); });
<span class="pl-smi">tbody</span>.<span class="pl-en">selectAll</span>(<span class="pl-s"><span class="pl-pds">'</span>tr<span class="pl-pds">'</span></span>).<span class="pl-c1">data</span>(yields)
    .<span class="pl-en">enter</span>().<span class="pl-c1">append</span>(<span class="pl-s"><span class="pl-pds">'</span>tr<span class="pl-pds">'</span></span>).<span class="pl-en">selectAll</span>(<span class="pl-s"><span class="pl-pds">'</span>td<span class="pl-pds">'</span></span>).<span class="pl-c1">data</span>(<span class="pl-k">function</span> (<span class="pl-smi">row</span>) { <span class="pl-k">return</span> <span class="pl-smi">d3</span>.<span class="pl-en">permute</span>(row, cols); })
        .<span class="pl-en">enter</span>().<span class="pl-c1">append</span>(<span class="pl-s"><span class="pl-pds">'</span>td<span class="pl-pds">'</span></span>).<span class="pl-c1">text</span>(<span class="pl-k">function</span> (<span class="pl-smi">d</span>) { <span class="pl-k">return</span> d; });</pre></div>

<p><a name="user-content-d3_zip" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_zip">#</a> d3.<strong>zip</strong>(<em>arrays…</em>)</p>

<p>返回的数组的数组，其中，第i个数组包含来自每个<em>arrays</em>参数的第i个元素。返回的数组长度被截断为<em>arrays</em>的最短的数组的长度。如果<em>arrays</em>只包含一个数组，则返回的数组是包含一个元素的数组。不带任何参数，则返回的数组是空的。</p>

<div class="highlight highlight-source-js"><pre><span class="pl-smi">d3</span>.<span class="pl-en">zip</span>([<span class="pl-c1">1</span>, <span class="pl-c1">2</span>], [<span class="pl-c1">3</span>, <span class="pl-c1">4</span>]); <span class="pl-c"><span class="pl-c">//</span> returns [[1, 3], [2, 4]]</span></pre></div>

<p><a name="user-content-d3_transpose" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_transpose">#</a> d3.<strong>transpose</strong>(<em>matrix</em>)</p>

<p>等价于<code>d3.zip.apply(null, matrix)</code>；使用zip操作符作为二维矩阵变换(<a href="http://en.wikipedia.org/wiki/Transpose">matrix transpose</a>)。</p>

<p><a name="user-content-d3_pairs" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_pairs">#</a> d3.<strong>pairs</strong>(<em>array</em>)</p>

<p>对指定参数array中元素的每个相邻对，返回元组(元素i和元素i-1)的新数组。例如：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-smi">d3</span>.<span class="pl-en">pairs</span>([<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">4</span>]); <span class="pl-c"><span class="pl-c">//</span> returns [[1, 2], [2, 3], [3, 4]]</span></pre></div>

<p>如果指定参数array 中少于两个元素，则返回一个空数组。</p>

<h3>
<a id="user-content-嵌套-nest" class="anchor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#%E5%B5%8C%E5%A5%97-nest" aria-hidden="true"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>嵌套 (Nest)</h3>

<p>嵌套允许数组中的元素被组织为分层树型结构；类似SQL语句里面的GROUP BY方法，但不能多级别分组，而且输出的结果是树而不是一般的表。树的层级由key方法指定。树的叶节点可以按值来排序，而内部节点可以按键来排序。可选参数汇总（rollup）函数可以使用加法函数瓦解每个叶节点的元素. nest 操作符(<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_nest">d3.nest</a>返回的对象)是可以重复使用的，不保留任何嵌套数据的引用。</p>

<p>例如，思考下面1931-2年间明尼苏达州（美国州名）麦田地皮的表格数据结构：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> yields <span class="pl-k">=</span> [{yield<span class="pl-k">:</span> <span class="pl-c1">27.00</span>, variety<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Manchuria<span class="pl-pds">"</span></span>, year<span class="pl-k">:</span> <span class="pl-c1">1931</span>, site<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>University Farm<span class="pl-pds">"</span></span>},
              {yield<span class="pl-k">:</span> <span class="pl-c1">48.87</span>, variety<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Manchuria<span class="pl-pds">"</span></span>, year<span class="pl-k">:</span> <span class="pl-c1">1931</span>, site<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Waseca<span class="pl-pds">"</span></span>},
              {yield<span class="pl-k">:</span> <span class="pl-c1">27.43</span>, variety<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Manchuria<span class="pl-pds">"</span></span>, year<span class="pl-k">:</span> <span class="pl-c1">1931</span>, site<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Morris<span class="pl-pds">"</span></span>}, <span class="pl-k">...</span>]</pre></div>

<p>为了方便查看，可以嵌套元素首先按year然后按variety，如下：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> nest <span class="pl-k">=</span> <span class="pl-smi">d3</span>.<span class="pl-en">nest</span>()
    .<span class="pl-c1">key</span>(<span class="pl-k">function</span>(<span class="pl-smi">d</span>) { <span class="pl-k">return</span> <span class="pl-smi">d</span>.<span class="pl-smi">year</span>; })
    .<span class="pl-c1">key</span>(<span class="pl-k">function</span>(<span class="pl-smi">d</span>) { <span class="pl-k">return</span> <span class="pl-smi">d</span>.<span class="pl-smi">variety</span>; })
    .<span class="pl-c1">entries</span>(yields);</pre></div>

<p>返回的嵌套数组中。每个元素的外部数组是键-值对，列出每个不同键的值:</p>

<div class="highlight highlight-source-js"><pre>[{key<span class="pl-k">:</span> <span class="pl-c1">1931</span>, values<span class="pl-k">:</span> [
    {key<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Manchuria<span class="pl-pds">"</span></span>, values<span class="pl-k">:</span> [
        {yield<span class="pl-k">:</span> <span class="pl-c1">27.00</span>, variety<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Manchuria<span class="pl-pds">"</span></span>, year<span class="pl-k">:</span> <span class="pl-c1">1931</span>, site<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>University Farm<span class="pl-pds">"</span></span>},
        {yield<span class="pl-k">:</span> <span class="pl-c1">48.87</span>, variety<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Manchuria<span class="pl-pds">"</span></span>, year<span class="pl-k">:</span> <span class="pl-c1">1931</span>, site<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Waseca<span class="pl-pds">"</span></span>},
        {yield<span class="pl-k">:</span> <span class="pl-c1">27.43</span>, variety<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Manchuria<span class="pl-pds">"</span></span>, year<span class="pl-k">:</span> <span class="pl-c1">1931</span>, site<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Morris<span class="pl-pds">"</span></span>}, <span class="pl-k">...</span>]},
    {key<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Glabron<span class="pl-pds">"</span></span>, values<span class="pl-k">:</span> [
        {yield<span class="pl-k">:</span> <span class="pl-c1">43.07</span>, variety<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Glabron<span class="pl-pds">"</span></span>, year<span class="pl-k">:</span> <span class="pl-c1">1931</span>, site<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>University Farm<span class="pl-pds">"</span></span>},
        {yield<span class="pl-k">:</span> <span class="pl-c1">55.20</span>, variety<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Glabron<span class="pl-pds">"</span></span>, year<span class="pl-k">:</span> <span class="pl-c1">1931</span>, site<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span>Waseca<span class="pl-pds">"</span></span>}, <span class="pl-k">...</span>]}, <span class="pl-k">...</span>]},
 {key<span class="pl-k">:</span> <span class="pl-c1">1932</span>, values<span class="pl-k">:</span> <span class="pl-k">...</span>}]</pre></div>

<p>嵌套的形式可以在SVG或HTML很容易迭代和生成层次结构。</p>

<p>有关 <code>d3.nest</code> 详见:</p>

<ul>
<li>Phoebe Bright’s <a href="http://bl.ocks.org/phoebebright/raw/3176159/">D3 Nest Tutorial and examples</a> </li>
<li>Shan Carter’s <a href="http://bl.ocks.org/shancarter/raw/4748131/">Mister Nester</a>
</li>
</ul>

<p><a name="user-content-d3_nest" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_nest">#</a> d3.<strong>nest</strong>()</p>

<p>创建一个新操作符。keys集合初始为空。如果<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#nest_map">map</a>或<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#nest_entries">entries</a> 操作符在任何键函数被注册之前被调用，这个嵌套操作符通常返回输入数组。例如<a href="http://bl.ocks.org/phoebebright/raw/3176159/">http://bl.ocks.org/phoebebright/raw/3176159/</a></p>

<p><a name="user-content-nest_key" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#nest_key">#</a> nest.<strong>key</strong>(<em>function</em>)</p>

<p>注册一个新的键函数<em>function</em>。键函数将被输入数组中的每个元素调用，并且必须返回一个用于分配元素到它的组内的字符串标识符。通常，这个函数被实现为一个简单的访问器，如上面例子中year和variety的访问器。 输入的数组的引导（index）并<em>没有</em>传递给<em>function</em>。每当一个key 被注册，它被放到一个内部键数组的末端，和由此产生的map或实体将有一个额外的层级。当前没有一个方法可以删除或查询注册的键。最近注册的键在后续的方法中被当作当前键。</p>

<p><a name="user-content-nest_sortKeys" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#nest_sortKeys">#</a> nest.<strong>sortKeys</strong>(<em>comparator</em>)</p>

<p>使用指定的参数<em>comparator</em>来给当前键值排序，等效于<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_descending">d3.descending</a>。如果没有指定comparator 参数键的排序则返回undefined。注意：只影响实体操作符的结果；map操作符返回键的顺序永远是undefined，无论什么比较器。</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> nest <span class="pl-k">=</span> <span class="pl-smi">d3</span>.<span class="pl-en">nest</span>()
    .<span class="pl-c1">key</span>(<span class="pl-k">function</span>(<span class="pl-smi">d</span>) { <span class="pl-k">return</span> <span class="pl-smi">d</span>.<span class="pl-smi">year</span>; })
    .<span class="pl-en">sortKeys</span>(<span class="pl-smi">d3</span>.<span class="pl-smi">ascending</span>)
    .<span class="pl-c1">entries</span>(yields);</pre></div>

<p><a name="user-content-nest_sortValues" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#nest_sortValues">#</a> nest.<strong>sortValues</strong>(<em>comparator</em>)</p>

<p>使用指定的<em>comparator</em>参数给叶子元素排序，等效于<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_descending">d3.descending</a>。这相当于在应用nest操作符前给输入的数组排序；然而，当每一组更小时它通常是更有效的。如果没有指定值的比较器，元素则按输入数组中显示的顺序排列。通常用于map和实体（entries）的操作符。</p>

<p><a name="user-content-nest_rollup" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#nest_rollup">#</a> nest.<strong>rollup</strong>(<em>function</em>)</p>

<p>为每组中的叶子元素指定汇总函数（rollup ）<em>function</em>。汇总函数的返回值会覆盖叶子值数组。不论是由map操作符返回的关联数组，还是实体操作符返回的每个实体的值属性。</p>

<p><a name="user-content-nest_map" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#nest_map">#</a> nest.<strong>map</strong>(<em>array</em>[, <em>mapType</em>])</p>

<p>对指定的数组使用nest操作符，返回一个关联数组。返回的关联数组<em>array</em>中每个实体对应由第一个key函数返回的不同的key值。实体值决定于注册的key函数的数量：如果有一个额外的key，值就是另外一个嵌套的关联数组；否则，值就是过滤自含有指定key值得输入数组<em>array</em>的元素数组。</p>

<p>如果指定了<em>mapType</em>，指定的函数就会用来构造一个map而不是返回一个简单的JavaScript对象。推荐使用<a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_map">d3.map</a> 实现这个目的，例如：</p>

<div class="highlight highlight-source-js"><pre><span class="pl-k">var</span> yieldsByYearAndVariety <span class="pl-k">=</span> <span class="pl-smi">d3</span>.<span class="pl-en">nest</span>()
    .<span class="pl-c1">key</span>(<span class="pl-k">function</span>(<span class="pl-smi">d</span>) { <span class="pl-k">return</span> <span class="pl-smi">d</span>.<span class="pl-smi">year</span>; })
    .<span class="pl-c1">key</span>(<span class="pl-k">function</span>(<span class="pl-smi">d</span>) { <span class="pl-k">return</span> <span class="pl-smi">d</span>.<span class="pl-smi">variety</span>; })
    .<span class="pl-en">map</span>(yields, <span class="pl-smi">d3</span>.<span class="pl-smi">map</span>);</pre></div>

<p>使用d3.map而不是一个对象提供便捷（例如：返回的map含有 <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_keys">keys</a> 和 <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#map_values">values</a> 函数），防止不寻常的键名与JavaScript内置的属性冲突，例如<code>__proto__</code>。</p>

<p><a name="user-content-nest_entries" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#nest_entries">#</a> nest.<strong>entries</strong>(<em>array</em>)</p>

<p>为指定的<em>array</em>参数应用nest操作符，返回一个键值对数组。从概念上讲，这和对 <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#nest_map">map</a> 返回的关联数组应用 <a href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#d3_entries">d3.entries</a> 操作符类似，但是这个是用于每一层而不是只有第一层（最外层）。返回数组中的每个实体对应于第一个key函数返回的不同的key值。实体值取决于注册的key函数的数量：如果有一个关联的key，值就是另外一个嵌套实体数组；否则，值就是含有指定key值得输入数组<em>array</em>过滤得到的元素数组。嵌套的案例： <a href="http://bl.ocks.org/phoebebright/raw/3176159/">http://bl.ocks.org/phoebebright/raw/3176159/</a></p>

<p>[<a name="user-content-accessor" href="https://github.com/d3/d3/wiki/%E6%95%B0%E7%BB%84#">1</a>] accessor function, 亦为getter, callback, 访问器, 常译作‘回调（函数）’。<a href="http://www.douban.com/group/topic/22835269/" title="http://www.douban.com/group/topic/22835269/">术语翻译 (计算机软件/编程)</a>  // Howard Liang 注 Nov 27, 2015</p>

<ul>
<li>Carry on 、2014-3-29翻译</li>
<li>咕噜2014-11-18翻译，并校对之前的翻译。</li>
</ul>

      </div>

  </div>
  </div>
</div>
</div>


  </div>
  <div class="modal-backdrop js-touch-events"></div>
</div>


    </div>
  </div>

    </div>

        <div class="container site-footer-container">
  <div class="site-footer" role="contentinfo">
    <ul class="site-footer-links float-right">
        <li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact GitHub</a></li>
      <li><a href="https://developer.github.com/" data-ga-click="Footer, go to api, text:api">API</a></li>
      <li><a href="https://training.github.com/" data-ga-click="Footer, go to training, text:training">Training</a></li>
      <li><a href="https://shop.github.com/" data-ga-click="Footer, go to shop, text:shop">Shop</a></li>
        <li><a href="https://github.com/blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li>
        <li><a href="https://github.com/about" data-ga-click="Footer, go to about, text:about">About</a></li>

    </ul>

    <a href="https://github.com/" aria-label="Homepage" class="site-footer-mark" title="GitHub">
      <svg aria-hidden="true" class="octicon octicon-mark-github" height="24" version="1.1" viewBox="0 0 16 16" width="24"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
</a>
    <ul class="site-footer-links">
      <li>© 2017 <span title="0.22552s from github-fe-bd32a9f.cp1-iad.github.net">GitHub</span>, Inc.</li>
        <li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li>
        <li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li>
        <li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li>
        <li><a href="https://status.github.com/" data-ga-click="Footer, go to status, text:status">Status</a></li>
        <li><a href="https://help.github.com/" data-ga-click="Footer, go to help, text:help">Help</a></li>
    </ul>
  </div>
</div>



    

    <div id="ajax-error-message" class="ajax-error-message flash flash-error">
      <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"></path></svg>
      <button type="button" class="flash-close js-flash-close js-ajax-error-dismiss" aria-label="Dismiss error">
        <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
      </button>
      You can't perform that action at this time.
    </div>


      
      
      
      
      
        

      
    <div class="js-stale-session-flash stale-session-flash flash flash-warn flash-banner d-none">
      <svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"></path></svg>
      <span class="signed-in-tab-flash">You signed in with another tab or window. <a href="数组 · d3_d3 Wiki_files/数组 · d3_d3 Wiki.html">Reload</a> to refresh your session.</span>
      <span class="signed-out-tab-flash">You signed out in another tab or window. <a href="数组 · d3_d3 Wiki_files/数组 · d3_d3 Wiki.html">Reload</a> to refresh your session.</span>
    </div>
    <div class="facebox" id="facebox" style="display:none;">
  <div class="facebox-popup">
    <div class="facebox-content" role="dialog" aria-labelledby="facebox-header" aria-describedby="facebox-description">
    </div>
    <button type="button" class="facebox-close js-facebox-close" aria-label="Close modal">
      <svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
    </button>
  </div>
</div>

  


</body></html>